﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TjZheng.Power.DataEntity;

namespace TjZheng.Power.Business
{
    public partial class BizPowerInfo
    {
        public List<PowerInfo> ConvertToPowerInfoList(DataTable objDataTable)
        {
            return objDataTable.Select().Select(c => ConvertToPowerInfo(c)).ToList();
        }

        public PowerInfo ConvertToPowerInfo(DataRow objDataRow)
        {
            PowerInfo model = new PowerInfo();
            model.Id = (long)objDataRow["Id"];
            model.PowerName = (string)objDataRow["PowerName"];
            model.PowerCode = (string)objDataRow["PowerCode"];
            model.ParentId = (long)objDataRow["ParentId"];
            model.HasChild = (int)objDataRow["HasChild"];
            model.IDPath = (string)objDataRow["IDPath"];
            model.Depth = (int)objDataRow["Depth"];
            model.ControllerName = (string)objDataRow["ControllerName"];
            model.ActionName = (string)objDataRow["ActionName"];
            model.LinkUrl = (string)objDataRow["LinkUrl"];
            model.PowerType = (int)objDataRow["PowerType"];
            model.Position = (int)objDataRow["Position"];
            model.Execution = (string)objDataRow["Execution"];
            model.Icon = (string)objDataRow["Icon"];
            model.IsDisplay = (int)objDataRow["IsDisplay"]; ;
            model.SortIndex = (long)objDataRow["SortIndex"];
            model.CreateDate = (DateTime)objDataRow["CreateDate"];
            return model;
        }

    }
}
